package demo.demo07.test02;

public class testYield {
    public static void main(String[] args) {
        myYield myYield = new myYield();
        new Thread(myYield, "a").start();
        new Thread(myYield, "b").start();

    }

}

class myYield implements Runnable {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "a");
        Thread.yield();
        System.out.println(Thread.currentThread().getName() + "b");

    }
}